/*
 * =====================================================================================
 *
 *       Filename:  tmpnam.c
 *
 *    Description:  use tempnam to create temp file
 *
 *        Version:  1.0
 *        Created:  2016年09月02日 21时23分38秒
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Dr. Fritz Mehner (mn), mehner@fh-swf.de
 *        Company:  FH Südwestfalen, Iserlohn
 *
 * =====================================================================================
 */

#include <stdio.h>
#include <stdlib.h>


	int
main ( int argc, char *argv[] )
{
	char tmpname[L_tmpnam];
	char *filename;
	FILE *tmpfp;
	filename=tmpnam(tmpname);
	
	printf("Temporary file name is : %s\n",filename);
	tmpfp=tmpfile();
	if(tmpfp)
		printf("Opend a temporary file OK");
	else
		perror("tmpfile");
	
	return EXIT_SUCCESS;
}				/* ----------  end of function main  ---------- */
